<include file="public/layout" />
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
	<div class="fixed-bar">
		<div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
			<div class="subject">
				<h3>自提点管理 - 编辑自提点</h3>
				<h5>网站系统自提点管理</h5>
			</div>
		</div>
	</div>
	<form class="form-horizontal" id="handleForm" action="{:U('Admin/Pickup/add')}" method="post">
		<input name="pickup_id" type="hidden" value="{$pickup['pickup_id']}" />
		<div class="ncap-form-default">
			<dl class="row">
				<dt class="tit">
					<label><em>*</em>自提点名称</label>
				</dt>
				<dd class="opt">
					<input type="text"  name="pickup_name" value="{$pickup.pickup_name}" class="input-txt">
					<p class="notic">自提点名称</p>
				</dd>
			</dl>
			<dl class="row">
				<dt class="tit">
					<label><em>*</em>自提点地址</label>
				</dt>
				<dd class="opt">
					<select name="province_id" id="province" onchange="get_city(this)">
						<option value="0">请选择</option>
						<volist name="province" id="p">
							<option <if condition="$pickup['province_id'] eq $p['id']">selected</if>  value="{$p.id}">{$p.name}</option>
						</volist>
					</select>
					<select name="city_id" id="city" onchange="get_area(this)">
						<option  value="0">请选择</option>
						<volist name="city" id="p">
							<option <if condition="$pickup['city_id'] eq $p['id']">selected</if>  value="{$p.id}">{$p.name}</option>
						</volist>
					</select>
					<select name="district_id" id="district">
						<option  value="0">请选择</option>
						<volist name="district" id="p">
							<option <if condition="$pickup['district_id'] eq $p['id']">selected</if>  value="{$p.id}">{$p.name}</option>
						</volist>
					</select>
					<p class="notic">自提点地址</p>
				</dd>
			</dl>
			<dl class="row">
				<dt class="tit">
					<label><em>*</em>供货商</label>
				</dt>
				<dd class="opt">
					<select name="suppliersid" id="suppliers_id">
						<option  value="0">不选则无供货商{$pickup['suppliers_id']}</option>
						<volist name="suppliers" id="s">
							<option <if condition="$pickup['suppliersid'] eq $s['suppliers_id']">selected="selected"</if>  value="{$s.suppliers_id}">{$s.suppliers_name}</option>
						</volist>
					</select>
					<p class="notic">供货商</p>
				</dd>
			</dl>
			<dl class="row">
				<dt class="tit">
					<label><em>*</em>详细地址</label>
				</dt>
				<dd class="opt">
					<textarea name="pickup_address" id="address" placeholder="详细地址" class="tarea" rows="6">{$pickup.pickup_address}</textarea>
					<p class="notic">详细地址</p>
				</dd>
			</dl>
			<dl class="row">
				<dt class="tit">
					<label>自提点联系人</label>
				</dt>
				<dd class="opt">
					<input type="text" name="pickup_contact" placeholder="自提点联系人" value="{$pickup.pickup_contact}" class="input-txt">
					<p class="notic"></p>
				</dd>
			</dl>
			<dl class="row">
				<dt class="tit">
					<label><em>*</em>自提点电话</label>
				</dt>
				<dd class="opt">
					<input type="text" name="pickup_phone" value="{$pickup.pickup_phone}" onpaste="this.value=this.value.replace(/[^\d-]/g,'')" onKeyUp="this.value=this.value.replace(/[^\d-]/g,'')" class="input-txt">
					<p class="notic"></p>
				</dd>
			</dl>
			<div class="bot"><a onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>
		</div>
	</form>
</div>
<script type="text/javascript">
	function checkForm(){
		var pickup_name = $('input[name="pickup_name"]').val();
		var province_id = $('select[name="province_id"]').find('option:selected').val();
		var city_id = $('select[name="city_id"]').find('option:selected').val();
		var district_id = $('select[name="district_id"]').find('option:selected').val();
		var pickup_address = $('textarea[name="pickup_address"]').val();
		var pickup_phone = $('input[name="pickup_phone"]').val();
		var error = '';
		if(pickup_name == ''){
			error += '自提点名称不能为空 <br/>';
		}
		if(province_id==0){
			error += '请选择省份 <br/>';
		}
		if(city_id==0){
			error += '请选择城市 <br/>';
		}
		if(district_id==0){
			error += '请选择区域 <br/>';
		}
		if(pickup_address == ''){
			error += '请填写地址 <br/>';
		}
		if(error){
			//alert(error);
			layer.alert(error, {icon: 2});
			//	layer.msg('只想弱弱提示');
			return false;
		}
		$('#handleForm').submit();
	}
</script>
</body>
</html>